package thread;

/**
 * Created with IDEA
 * author:ju bai
 * Date:2021/4/27
 * Time:10:44
 **/
public class ThreadDemo5 {
    public static void main(String[] args) {
        //创建一个任务
        Runnable runnable = new Runnable() {
            @Override
            public void run() {
                System.out.println("线程名称" + Thread.currentThread().getName());
                try {
                    Thread.sleep(9999999);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        };
        Thread t1 = new Thread(runnable, "qwe");
        Thread t2 = new Thread(runnable, "asd");
        t1.start();
        t2.start();
    }
}
